﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;
using Headlight.Domain.Entities;
using Headlight.Domain.Repositories;
using System.Linq;
using System.Linq.Expressions;
using System.ComponentModel;

namespace Headlight.Helpers
{
	public class ValidationHelpers
	{
        //IDictionary<string, object> validationAttributes = htmlHelper.GetUnobtrusiveValidationAttributes(ExpressionHelper.GetExpressionText(expression),metadata);
        /* public static IHtmlString DropDownListWithLabelFor<TModel, TProperty>(this HtmlHelper<TModel> helper, Expression<Func<TModel, TProperty>> expression, string label, IEnumerable<SelectListItem> items, string blankOption, object htmlAttributes = null)
         {
             var l = new TagBuilder("label");
             var br = new TagBuilder("br");

             var metadata = ModelMetadata.FromLambdaExpression(expression, helper.ViewData);
             var mergedAttributes = helper.GetUnobtrusiveValidationAttributes(ExpressionHelper.GetExpressionText(expression), metadata);

             if (htmlAttributes != null)
             {
                 foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(htmlAttributes))
                 {
                     object value = descriptor.GetValue(htmlAttributes);
                     mergedAttributes.Add(descriptor.Name, value);
                 }
             }

             l.InnerHtml = label + br.ToString(TagRenderMode.SelfClosing) + helper.DropDownListFor(expression, items, blankOption, mergedAttributes);
             return MvcHtmlString.Create(l.ToString(TagRenderMode.Normal));
         }*/
    }


}